home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / twin16.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  62KB  |  1,685 lines

  1. /*
  2. Konami "Twin16"
  3.  
  4. driver by Phil Stroffolino
  5.  
  6. CPU   : 68000(10M)x2 Z-80
  7. SOUND : YM2151 007232 uPD7759C
  8. OSC.  : 3.579545MHz 18432.00KHz
  9.  
  10. Main processors are a pair of 68000 CPUs
  11. Sounds are generated by a Z80, a Yamaha 2151 and 3012, a Konami custom IC and a UPD7759C
  12.  
  13.         Dark Adventure / Devil World / Majuu no Ohkoku
  14.         Vulcan Venture / Gradius II
  15.         Cuebrick
  16.         MIA (Japan)
  17.         Final Round / Hard Puncher (Japan)
  18.  
  19. Known Issues:
  20.     - battery-backed RAM isn't handled properly (CueBrick)
  21.     - some rogue sprites in Devil World
  22.     - sprite-background priority isn't correct (see intro screen of Devil World)
  23.  
  24. 68000 Memory Map for Konami Twin System
  25.  
  26.     CPUA                                        CPUB
  27.     0x000000..0x03ffff    ROM                        0x000000..0x03ffff
  28.     0x040000..0x043fff    communication RAM        0x040000..0x043fff (shared)
  29.     0x060000..0x063fff    work RAM                0x060000..0x063fff
  30.     0x080000..0x080fff    palette
  31.     0x080000..0x09ffff    ROM (extra tile data)
  32.     0x0a0000..0x0a0001    IRQ control                0x0a0000..0x0a0001
  33.     0x0a0008..0x0a0009    sound command
  34.     0x0a0010..0xa00011    watchdog
  35.     0x0c0000..0x0c0001    screenflip
  36.     0x0c0002..0x0c000f    scroll registers
  37.  
  38.     0x100000..0x103fff    FIXRAM (text layer)
  39.     0x120000..0x123fff    VIDRAM (tilemaps)        0x480000..0x483fff (shared)
  40.     0x140000..0x143fff    OBJRAM (sprites)        0x400000..0x403fff (shared)
  41.                         ZIP RAM    (tiles)            0x500000..0x53ffff
  42.                         gfx ROM (banked)        0x600000..0x77ffff
  43.                         sprite gfx RAM            0x780000..0x79ffff
  44. */
  45.  
  46. #include "driver.h"
  47. #include "vidhrdw/generic.h"
  48. #include "cpu/m68000/m68000.h"
  49. #include "cpu/z80/z80.h"
  50.  
  51. WRITE_HANDLER( fround_gfx_bank_w );
  52. WRITE_HANDLER( twin16_video_register_w );
  53.  
  54. extern int twin16_vh_start( void );
  55. extern void twin16_vh_stop( void );
  56. extern void twin16_vh_screenrefresh( struct osd_bitmap *bitmap, int fullrefresh );
  57.  
  58. extern void twin16_spriteram_process( void );
  59.  
  60. /******************************************************************************************/
  61.  
  62. UINT16 twin16_custom_vidhrdw;
  63. UINT16 *twin16_gfx_rom;
  64. unsigned char *twin16_sprite_gfx_ram;
  65. unsigned char *twin16_tile_gfx_ram;
  66. unsigned char *twin16_fixram; /* text layer */
  67.  
  68. static UINT16 twin16_CPUA_register, twin16_CPUB_register;
  69. #define CPUA_IRQ_ENABLE (twin16_CPUA_register&0x20)
  70. #define CPUB_IRQ_ENABLE (twin16_CPUB_register&0x02)
  71.  
  72. static UINT8 twin16_soundlatch;
  73. static UINT16 twin16_sound_command;
  74.  
  75. static unsigned char *battery_backed_ram;
  76.  
  77.  
  78.  
  79. int twin16_spriteram_process_enable( void )
  80. {
  81.     return (twin16_CPUA_register&0x40)==0;
  82. }
  83.  
  84. enum
  85. {
  86.     CPU_SOUND,
  87.     CPU_B,
  88.     CPU_A
  89. };
  90.  
  91.  
  92. /******************************************************************************************/
  93.  
  94. #define WORKRAM_CPUA_r                MRA_BANK1
  95. #define WORKRAM_CPUA_w                MWA_BANK1
  96.  
  97. #define WORKRAM_CPUB_r                MRA_BANK2
  98. #define WORKRAM_CPUB_w                MWA_BANK2
  99.  
  100. #define FIXRAM_r                    MRA_BANK3
  101. #define FIXRAM_w                    MWA_BANK3, &twin16_fixram
  102.  
  103. #define COMRAM_r                    MRA_BANK4
  104. #define COMRAM_w                    MWA_BANK4
  105.  
  106. #define twin16_sprite_gfx_ram_w        MWA_BANK5, &twin16_sprite_gfx_ram
  107. #define twin16_sprite_gfx_ram_r        MRA_BANK5
  108.  
  109. #define twin16_tile_gfx_ram_w        MWA_BANK6, &twin16_tile_gfx_ram
  110. #define twin16_tile_gfx_ram_r        MRA_BANK7
  111.  
  112. READ_HANDLER( VIDRAM_r ){ return READ_WORD(&videoram[offset]); }
  113. WRITE_HANDLER( VIDRAM_w ){ COMBINE_WORD_MEM(&videoram[offset],data); }
  114.  
  115. READ_HANDLER( OBJRAM_r ){ return READ_WORD(&spriteram[offset]); }
  116. WRITE_HANDLER( OBJRAM_w ){ COMBINE_WORD_MEM(&spriteram[offset],data); }
  117.  
  118.  
  119. READ_HANDLER( battery_backed_ram_r )
  120. {
  121.     return READ_WORD(&battery_backed_ram[offset]);
  122. }
  123.  
  124. WRITE_HANDLER( battery_backed_ram_w )
  125. {
  126.     COMBINE_WORD_MEM(&battery_backed_ram[offset],data);
  127. }
  128.  
  129. static void cuebrick_nvram_handler(void *file,int read_or_write)
  130. {
  131.     if (read_or_write)
  132.         osd_fwrite(file,battery_backed_ram,0x4000);
  133.     else
  134.     {
  135.         if (file)
  136.             osd_fread(file,battery_backed_ram,0x4000);
  137.         else
  138.             memset(battery_backed_ram,0,0x4000);
  139.     }
  140. }
  141.  
  142. /******************************************************************************************/
  143.  
  144. static READ_HANDLER( extra_rom_r )
  145. {
  146.     return ((UINT16 *)memory_region(REGION_GFX3))[offset/2];
  147. }
  148.  
  149. static READ_HANDLER( twin16_gfx_rom1_r )
  150. {
  151.     return twin16_gfx_rom[offset/2];
  152. }
  153.  
  154. static READ_HANDLER( twin16_gfx_rom2_r )
  155. {
  156.     return twin16_gfx_rom[offset/2 + 0x80000 + ((twin16_CPUB_register&0x04)?0x40000:0)];
  157. }
  158.  
  159. static WRITE_HANDLER( twin16_paletteram_w )
  160. { // identical to tmnt_paletteram_w
  161.     int oldword = READ_WORD(&paletteram[offset]);
  162.     int newword = COMBINE_WORD(oldword,data);
  163.     WRITE_WORD(&paletteram[offset],newword);
  164.  
  165.     offset /= 4;
  166.     {
  167.         int palette = ((READ_WORD(&paletteram[offset * 4]) & 0x00ff) << 8)
  168.                 + (READ_WORD(&paletteram[offset * 4 + 2]) & 0x00ff);
  169.         int r = palette & 31;
  170.         int g = (palette >> 5) & 31;
  171.         int b = (palette >> 10) & 31;
  172.  
  173.         r = (r << 3) + (r >> 2);
  174.         g = (g << 3) + (g >> 2);
  175.         b = (b << 3) + (b >> 2);
  176.  
  177.         palette_change_color (offset,r,g,b);
  178.     }
  179. }
  180.  
  181.  
  182. /******************************************************************************************/
  183.  
  184. static WRITE_HANDLER( sound_command_w )
  185. {
  186.     twin16_sound_command = COMBINE_WORD( twin16_sound_command, data );
  187.     soundlatch_w( 0, twin16_sound_command&0xff );
  188. }
  189.  
  190. static int CPUA_interrupt( void )
  191. {
  192.     return CPUA_IRQ_ENABLE?MC68000_IRQ_5:MC68000_INT_NONE;
  193. }
  194.  
  195. static int CPUB_interrupt( void )
  196. {
  197.     return CPUB_IRQ_ENABLE?MC68000_IRQ_5:MC68000_INT_NONE;
  198. }
  199.  
  200. static READ_HANDLER( twin16_sprite_status_r )
  201. {
  202.     /*
  203.         return value indicates whether the spriteram-processing circuitry
  204.         is busy.
  205.  
  206.         for now, we'll just alternate the value every time it is read
  207.     */
  208.     static int k;
  209.     k = 1-k;
  210.     return k;
  211. }
  212.  
  213. static WRITE_HANDLER( twin16_CPUA_register_w )
  214. {
  215.     /*
  216.         7    6    5    4    3    2    1    0
  217.             ?                            sprite protection disable
  218.                 X                        IRQ5 enable (CPUA)
  219.                     X                    0->1 trigger IRQ6 on CPUB
  220.                         X                0->1 trigger IRQ on sound CPU
  221.                                 x    x    coin counters
  222.     */
  223.     UINT16 old = twin16_CPUA_register;
  224.     twin16_CPUA_register = COMBINE_WORD( old, data );
  225.     if( twin16_CPUA_register!=old )
  226.     {
  227.         if( (old&0x08)==0 && (twin16_CPUA_register&0x08) )
  228.         {
  229.             cpu_cause_interrupt( CPU_SOUND, 0xff );
  230.         }
  231.  
  232.         if( (old&0x40) && (twin16_CPUA_register&0x40)==0 )
  233.         {
  234.             twin16_spriteram_process();
  235.         }
  236.  
  237.         if( (old&0x10)==0 && (twin16_CPUA_register&0x10) )
  238.         {
  239.             cpu_cause_interrupt( CPU_B, MC68000_IRQ_6 );
  240.         }
  241.         coin_counter_w( 0, twin16_CPUA_register&0x01 );
  242.         coin_counter_w( 1, twin16_CPUA_register&0x02 );
  243.     }
  244. }
  245.  
  246. static WRITE_HANDLER( twin16_CPUB_register_w )
  247. {
  248.     /*
  249.         7    6    5    4    3    2    1    0
  250.                             X            gfx bank select
  251.                                 X        IRQ5 enable
  252.                                     X    0->1 trigger IRQ6 on CPUA
  253.     */
  254.     UINT16 old = twin16_CPUB_register;
  255.     twin16_CPUB_register = COMBINE_WORD( old, data );
  256.     if( twin16_CPUB_register!=old )
  257.     {
  258.         if( (old&0x01)==0 && (twin16_CPUB_register&0x1) )
  259.         {
  260.             cpu_cause_interrupt( CPU_A, MC68000_IRQ_6 );
  261.         }
  262.     }
  263. }
  264.  
  265. static WRITE_HANDLER( fround_CPU_register_w )
  266. {
  267.     UINT16 old = twin16_CPUA_register;
  268.     twin16_CPUA_register = COMBINE_WORD( old, data );
  269.     if( twin16_CPUA_register!=old )
  270.     {
  271.         if( (old&0x08)==0 && (twin16_CPUA_register&0x08) )
  272.             cpu_cause_interrupt( CPU_SOUND, 0xff ); // trigger IRQ on sound CPU
  273.     }
  274. }
  275.  
  276. /******************************************************************************************/
  277.  
  278. static READ_HANDLER( twin16_input_r )
  279. {
  280.     switch( offset )
  281.     {
  282.         case 0x00: return readinputport(0); // coin
  283.         case 0x02: return readinputport(1); // p1
  284.         case 0x04: return readinputport(2); // p2
  285.         case 0x06: return readinputport(3); // p3? (Devils World)
  286.         case 0x10: return readinputport(5); // DSW1
  287.         case 0x12: return readinputport(4); // DSW2
  288.         case 0x18: return readinputport(6); // DSW3
  289.     }
  290.     return 0;
  291. }
  292.  
  293. /******************************************************************************************/
  294. /* sound system */
  295.  
  296. READ_HANDLER( twin16_sres_r )
  297. {
  298.     return twin16_soundlatch;
  299. }
  300.  
  301. WRITE_HANDLER( twin16_sres_w )
  302. {
  303.     /* bit 1 resets the UPD7795C sound chip */
  304.     if ((data & 0x02) == 0)
  305.     {
  306.         UPD7759_reset_w(0,(data & 0x02) >> 1);
  307.     }
  308.     twin16_soundlatch = data;
  309. }
  310.  
  311.  
  312. // Added by Takahiro Nogi. (1999/10/27)
  313. static WRITE_HANDLER( twin16_UPD7759_start_w )
  314. {
  315.     UPD7759_start_w(offset, (!(data & 0x01)));
  316. }
  317.  
  318. static struct MemoryReadAddress readmem_sound[] =
  319. {
  320.     { 0x0000, 0x7fff, MRA_ROM },
  321.     { 0x8000, 0x8fff, MRA_RAM },
  322.     { 0x9000, 0x9000, twin16_sres_r },
  323.     { 0xa000, 0xa000, soundlatch_r },
  324.     { 0xb000, 0xb00d, K007232_read_port_0_r },
  325.     { 0xc001, 0xc001, YM2151_status_port_0_r },
  326.     { 0xf000, 0xf000, UPD7759_0_busy_r },
  327.     { -1 }
  328. };
  329.  
  330. static struct MemoryWriteAddress writemem_sound[] =
  331. {
  332.     { 0x0000, 0x7fff, MWA_ROM },
  333.     { 0x8000, 0x8fff, MWA_RAM },
  334.     { 0x9000, 0x9000, twin16_sres_w },
  335.     { 0xb000, 0xb00d, K007232_write_port_0_w  },
  336.     { 0xc000, 0xc000, YM2151_register_port_0_w },
  337.     { 0xc001, 0xc001, YM2151_data_port_0_w },
  338.     { 0xd000, 0xd000, UPD7759_0_message_w },
  339.     { 0xe000, 0xe000, twin16_UPD7759_start_w },    // Changed by Takahiro Nogi. (1999/10/27)
  340.     { -1 }
  341. };
  342.  
  343. /******************************************************************************************/
  344.  
  345. static struct MemoryReadAddress readmem[] =
  346. {
  347.     { 0x000000, 0x03ffff, MRA_ROM },
  348.     { 0x040000, 0x043fff, COMRAM_r },
  349.     { 0x060000, 0x063fff, WORKRAM_CPUA_r },
  350.     { 0x080000, 0x080fff, paletteram_word_r },
  351.     { 0x0a0000, 0x0a001b, twin16_input_r },
  352.     { 0x0b0000, 0x0b3fff, battery_backed_ram_r }, /* cuebrick only */
  353.     { 0x0c000e, 0x0c000f, twin16_sprite_status_r },
  354.     { 0x100000, 0x103fff, FIXRAM_r },
  355.     { 0x120000, 0x123fff, VIDRAM_r },
  356.     { 0x140000, 0x143fff, OBJRAM_r },
  357.     { -1 }
  358. };
  359.  
  360. static struct MemoryWriteAddress writemem[] =
  361. {
  362.     { 0x000000, 0x03ffff, MWA_ROM },
  363.     { 0x040000, 0x043fff, COMRAM_w },
  364.     { 0x060000, 0x063fff, WORKRAM_CPUA_w },
  365.     { 0x080000, 0x080fff, twin16_paletteram_w, &paletteram },
  366.     { 0x081000, 0x081fff, MWA_NOP },
  367.     { 0x0a0000, 0x0a0001, twin16_CPUA_register_w },
  368.     { 0x0a0008, 0x0a0009, sound_command_w },
  369.     { 0x0a0010, 0x0a0011, MWA_NOP }, /* watchdog */
  370.     { 0x0b0000, 0x0b3fff, battery_backed_ram_w, &battery_backed_ram }, /* cuebrick only */
  371.     { 0x0c0000, 0x0c000f, twin16_video_register_w },
  372.     { 0x100000, 0x103fff, FIXRAM_w },
  373.     { 0x120000, 0x123fff, VIDRAM_w, &videoram },
  374.     { 0x140000, 0x143fff, OBJRAM_w, &spriteram },
  375.     { -1 }
  376. };
  377.  
  378. static struct MemoryReadAddress readmem_sub[] =
  379. {
  380.     { 0x000000, 0x03ffff, MRA_ROM },
  381.     { 0x040000, 0x043fff, COMRAM_r },
  382.     { 0x060000, 0x063fff, WORKRAM_CPUB_r },
  383.     { 0x080000, 0x09ffff, extra_rom_r },
  384.     { 0x400000, 0x403fff, OBJRAM_r },
  385.     { 0x480000, 0x483fff, VIDRAM_r },
  386.     { 0x500000, 0x53ffff, twin16_tile_gfx_ram_r },
  387.     { 0x600000, 0x6fffff, twin16_gfx_rom1_r },
  388.     { 0x700000, 0x77ffff, twin16_gfx_rom2_r },
  389.     { 0x780000, 0x79ffff, twin16_sprite_gfx_ram_r },
  390.     { -1 }
  391. };
  392.  
  393. static struct MemoryWriteAddress writemem_sub[] =
  394. {
  395.     { 0x000000, 0x03ffff, MWA_ROM },
  396.     { 0x040000, 0x043fff, COMRAM_w },
  397.     { 0x060000, 0x063fff, WORKRAM_CPUB_w },
  398.     { 0x0a0000, 0x0a0001, twin16_CPUB_register_w },
  399.     { 0x400000, 0x403fff, OBJRAM_w },
  400.     { 0x480000, 0x483fff, VIDRAM_w },
  401.     { 0x500000, 0x53ffff, twin16_tile_gfx_ram_w },
  402.     { 0x780000, 0x79ffff, twin16_sprite_gfx_ram_w },
  403.     { -1 }
  404. };
  405.  
  406. /******************************************************************************************/
  407.  
  408. static struct MemoryReadAddress fround_readmem[] =
  409. {
  410.     { 0x000000, 0x03ffff, MRA_ROM },
  411.     { 0x040000, 0x043fff, COMRAM_r },
  412.     { 0x060000, 0x063fff, WORKRAM_CPUA_r },
  413.     { 0x080000, 0x080fff, paletteram_word_r },
  414.     { 0x0a0000, 0x0a001b, twin16_input_r },
  415.     { 0x0c000e, 0x0c000f, twin16_sprite_status_r },
  416.     { 0x100000, 0x103fff, FIXRAM_r },
  417.     { 0x120000, 0x123fff, VIDRAM_r },
  418.     { 0x140000, 0x143fff, OBJRAM_r },
  419.     { 0x500000, 0x6fffff, twin16_gfx_rom1_r },
  420.     { -1 }
  421. };
  422.  
  423. static struct MemoryWriteAddress fround_writemem[] =
  424. {
  425.     { 0x000000, 0x03ffff, MWA_ROM },
  426.     { 0x040000, 0x043fff, COMRAM_w },
  427.     { 0x060000, 0x063fff, WORKRAM_CPUA_w },
  428.     { 0x080000, 0x080fff, twin16_paletteram_w, &paletteram },
  429.     { 0x0a0000, 0x0a0001, fround_CPU_register_w },
  430.     { 0x0a0008, 0x0a0009, sound_command_w },
  431.     { 0x0a0010, 0x0a0011, MWA_NOP }, /* watchdog */
  432.     { 0x0c0000, 0x0c000f, twin16_video_register_w },
  433.     { 0x0e0000, 0x0e0001, fround_gfx_bank_w },
  434.     { 0x100000, 0x103fff, FIXRAM_w },
  435.     { 0x120000, 0x123fff, VIDRAM_w, &videoram },
  436.     { 0x140000, 0x143fff, OBJRAM_w, &spriteram },
  437.     { -1 }
  438. };
  439.  
  440. /******************************************************************************************/
  441.  
  442. #define KONAMI_TWIN_COINAGE PORT_START \
  443.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) \
  444.     PORT_DIPSETTING(    0x00, "freeplay" ) \
  445.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) ) \
  446.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) ) \
  447.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) ) \
  448.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) ) \
  449.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) ) \
  450.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) ) \
  451.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) ) \
  452.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) ) \
  453.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) ) \
  454.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) ) \
  455.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) ) \
  456.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) ) \
  457.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) ) \
  458.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) ) \
  459.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) ) \
  460.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) \
  461.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) ) \
  462.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) ) \
  463.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) ) \
  464.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) ) \
  465.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) ) \
  466.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) ) \
  467.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) ) \
  468.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) ) \
  469.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) ) \
  470.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) ) \
  471.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) ) \
  472.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) ) \
  473.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) ) \
  474.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) ) \
  475.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  476.  
  477. INPUT_PORTS_START( twin16 ) /* generic */
  478.     PORT_START      /* 0xa0001 */
  479.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  480.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  481.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  482.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) /* advances through tests */
  483.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  484.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  485.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )
  486.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  487.  
  488.     PORT_START      /* 0xa0003 */
  489.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 | IPF_8WAY )
  490.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  491.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_8WAY )
  492.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_8WAY )
  493.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  494.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  495.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  496.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  497.  
  498.     PORT_START      /* 0xa0005 */
  499.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 | IPF_8WAY )
  500.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  501.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_8WAY )
  502.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_8WAY )
  503.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  504.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  505.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  506.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  507.  
  508.     PORT_START      /* 0xa0007 */
  509.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER3 | IPF_8WAY )
  510.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
  511.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER3 | IPF_8WAY )
  512.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER3 | IPF_8WAY )
  513.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  514.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  515.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  516.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  517.  
  518.     KONAMI_TWIN_COINAGE
  519.  
  520.     PORT_START    /* DSW2 */
  521.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  522.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  523.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  524.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  525.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  526.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  527.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
  528.     PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
  529.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  530.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  531.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  532.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  533.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  534.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  535.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  536.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  537.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  538.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  539.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  540.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  541.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  542.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  543.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  544.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  545.  
  546.     PORT_START    /* DSW3 0xa0018 */
  547.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  548.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  549.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  550.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  551.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  552.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  553.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  554.     PORT_DIPNAME( 0x08, 0x08, "Reserved" )
  555.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  556.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  557.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  558. INPUT_PORTS_END
  559.  
  560. INPUT_PORTS_START( fround )
  561.     PORT_START      /* 0xa0001 */
  562.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  563.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  564.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  565.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) /* advances through tests */
  566.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  567.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  568.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )
  569.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  570.  
  571.     PORT_START      /* 0xa0003 */
  572.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 | IPF_8WAY )
  573.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  574.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_8WAY )
  575.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_8WAY )
  576.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  577.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  578.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  579.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  580.  
  581.     PORT_START      /* 0xa0005 */
  582.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 | IPF_8WAY )
  583.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  584.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_8WAY )
  585.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_8WAY )
  586.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  587.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  588.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  589.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  590.  
  591.     PORT_START      /* 0xa0007 */
  592.     PORT_BIT( 0xff, 0xff, IPT_UNUSED )
  593.  
  594.     KONAMI_TWIN_COINAGE
  595.  
  596.     PORT_START    /* DSW2 */
  597.     PORT_DIPNAME( 0x03, 0x03, "Player's Basic Power" )
  598.     PORT_DIPSETTING(    0x03, "18" )
  599.     PORT_DIPSETTING(    0x02, "20" )
  600.     PORT_DIPSETTING(    0x01, "22" )
  601.     PORT_DIPSETTING(    0x00, "24" )
  602.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
  603.     PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
  604.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  605.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  606.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  607.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  608.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  609.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  610.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  611.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  612.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  613.     PORT_DIPSETTING(    0x20, "Difficult" )
  614.     PORT_DIPSETTING(    0x40, "Normal" )
  615.     PORT_DIPSETTING(    0x60, "Easy" )
  616.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  617.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  618.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  619.     PORT_START    /* DSW3 0xa0018 */
  620.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  621.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  622.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  623.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  624.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  625.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  626.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  627.     PORT_DIPNAME( 0x08, 0x08, "Reserved" )
  628.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  629.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  630.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  631. INPUT_PORTS_END
  632.  
  633. INPUT_PORTS_START( vulcan )
  634.     PORT_START      /* 0xa0001 */
  635.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  636.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  637.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  638.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) /* advances through tests */
  639.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  640.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  641.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )
  642.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  643.  
  644.     PORT_START      /* 0xa0003 */
  645.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 | IPF_8WAY )
  646.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  647.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_8WAY )
  648.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_8WAY )
  649.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
  650.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  651.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
  652.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  653.  
  654.     PORT_START      /* 0xa0005 */
  655.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 | IPF_8WAY )
  656.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  657.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_8WAY )
  658.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_8WAY )
  659.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  660.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  661.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  662.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  663.  
  664.     PORT_START      /* 0xa0007 */
  665.     PORT_BIT( 0xff, 0xff, IPT_UNUSED )
  666.  
  667.     KONAMI_TWIN_COINAGE
  668.  
  669.     PORT_START    /* DSW2 */
  670.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  671.     PORT_DIPSETTING(    0x03, "2" )
  672.     PORT_DIPSETTING(    0x02, "3" )
  673.     PORT_DIPSETTING(    0x01, "4" )
  674.     PORT_DIPSETTING(    0x00, "7" )
  675.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  676.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  677.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  678.     PORT_DIPNAME( 0x18, 0x18, "Bonus" )
  679.     PORT_DIPSETTING(    0x08, "20K" )
  680.     PORT_DIPSETTING(    0x18, "20K/70K" )
  681.     PORT_DIPSETTING(    0x10, "30K/80K" )
  682.     PORT_DIPSETTING(    0x00, "70K" )
  683.     PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
  684.     PORT_DIPSETTING(    0x60, "Easy" )
  685.     PORT_DIPSETTING(    0x40, "Normal" )
  686.     PORT_DIPSETTING(    0x20, "Difficult" )
  687.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  688.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  689.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  690.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  691.  
  692.     PORT_START    /* DSW3 0xa0018 */
  693.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  694.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  695.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  696.     PORT_DIPNAME( 0x02, 0x00, "Controls" )
  697.     PORT_DIPSETTING(    0x02, "Single" )
  698.     PORT_DIPSETTING(    0x00, "Dual" )
  699.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  700.     PORT_DIPNAME( 0x08, 0x08, "Reserved" )
  701.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  702.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  703.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  704. INPUT_PORTS_END
  705.  
  706. /* same as vulcan, different bonus */
  707. INPUT_PORTS_START( gradius2 )
  708.     PORT_START      /* 0xa0001 */
  709.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  710.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  711.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  712.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) /* advances through tests */
  713.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  714.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  715.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )
  716.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  717.  
  718.     PORT_START      /* 0xa0003 */
  719.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 | IPF_8WAY )
  720.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  721.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_8WAY )
  722.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_8WAY )
  723.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
  724.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  725.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
  726.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  727.  
  728.     PORT_START      /* 0xa0005 */
  729.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 | IPF_8WAY )
  730.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  731.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_8WAY )
  732.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_8WAY )
  733.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  734.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  735.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  736.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  737.  
  738.     PORT_START      /* 0xa0007 */
  739.     PORT_BIT( 0xff, 0xff, IPT_UNUSED )
  740.  
  741.     KONAMI_TWIN_COINAGE
  742.  
  743.     PORT_START    /* DSW2 */
  744.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  745.     PORT_DIPSETTING(    0x03, "2" )
  746.     PORT_DIPSETTING(    0x02, "3" )
  747.     PORT_DIPSETTING(    0x01, "4" )
  748.     PORT_DIPSETTING(    0x00, "7" )
  749.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  750.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  751.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  752.     PORT_DIPNAME( 0x18, 0x18, "Bonus" )
  753.     PORT_DIPSETTING(    0x08, "20K" )
  754.     PORT_DIPSETTING(    0x18, "20K/150K" )
  755.     PORT_DIPSETTING(    0x10, "30K/200K" )
  756.     PORT_DIPSETTING(    0x00, "70K" )
  757.     PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
  758.     PORT_DIPSETTING(    0x60, "Easy" )
  759.     PORT_DIPSETTING(    0x40, "Normal" )
  760.     PORT_DIPSETTING(    0x20, "Difficult" )
  761.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  762.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  763.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  764.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  765.  
  766.     PORT_START    /* DSW3 0xa0018 */
  767.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  768.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  769.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  770.     PORT_DIPNAME( 0x02, 0x00, "Controls" )
  771.     PORT_DIPSETTING(    0x02, "Single" )
  772.     PORT_DIPSETTING(    0x00, "Dual" )
  773.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  774.     PORT_DIPNAME( 0x08, 0x08, "Reserved" )
  775.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  776.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  777.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  778. INPUT_PORTS_END
  779.  
  780. INPUT_PORTS_START( darkadv )
  781.     PORT_START      /* 0xa0001 */
  782.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  783.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  784.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  785.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) /* "map" button (also advances through tests */
  786.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
  787.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
  788.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN4 ) /* SERVICE1 */
  789.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 |IPF_PLAYER2 ) /* SERVICE2 */
  790.  
  791.     PORT_START      /* 0xa0003 */
  792.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 | IPF_8WAY )
  793.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  794.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_8WAY )
  795.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_8WAY )
  796.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* START1 */
  797.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  798.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  799.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER3 ) /* SERVICE3 */
  800.  
  801.     PORT_START      /* 0xa0005 */
  802.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 | IPF_8WAY )
  803.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  804.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_8WAY )
  805.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_8WAY )
  806.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 ) /* START2 */
  807.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  808.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  809.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  810.  
  811.     PORT_START      /* 0xa0007 */
  812.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER3 | IPF_8WAY )
  813.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
  814.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER3 | IPF_8WAY )
  815.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER3 | IPF_8WAY )
  816.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 ) /* START3 */
  817.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  818.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  819.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  820.  
  821.     KONAMI_TWIN_COINAGE
  822.  
  823.     PORT_START    /* DSW2 */
  824.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  825.     PORT_DIPSETTING(    0x03, "2" )
  826.     PORT_DIPSETTING(    0x02, "3" )
  827.     PORT_DIPSETTING(    0x01, "5" )
  828.     PORT_DIPSETTING(    0x00, "7" )
  829.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  830.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  831.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  832.  
  833.     PORT_DIPNAME( 0x08, 0x08, "Special" )//#players?
  834.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  835.  
  836.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  837.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  838.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  839.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  840.  
  841.     PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
  842.     PORT_DIPSETTING(    0x60, "Easy" )
  843.     PORT_DIPSETTING(    0x40, "Normal" )
  844.     PORT_DIPSETTING(    0x20, "Difficult" )
  845.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  846.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  847.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  848.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  849.  
  850.     PORT_START    /* DSW3 0xa0019 */
  851.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  852.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  853.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  854.     PORT_DIPNAME( 0x02, 0x00, "Controls" )
  855.     PORT_DIPSETTING(    0x02, "Single" )
  856.     PORT_DIPSETTING(    0x00, "Dual" )
  857.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  858.     PORT_DIPNAME( 0x08, 0x08, "Reserved" )
  859.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  860.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  861.  
  862.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  863.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  864.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  865.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  866.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  867.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  868.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  869.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  870.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  871.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  872.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  873.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  874.  
  875. //    PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  876. INPUT_PORTS_END
  877.  
  878. INPUT_PORTS_START( devilw )
  879.     PORT_START      /* 0xa0001 */
  880.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  881.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  882.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  883.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) /* "map" button (also advances through tests */
  884.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 )
  885.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 )
  886.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )
  887.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 )
  888.  
  889.     PORT_START      /* 0xa0003 */
  890.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 | IPF_8WAY )
  891.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  892.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_8WAY )
  893.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_8WAY )
  894.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) /* also used in-game */
  895.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  896.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
  897.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
  898.  
  899.     PORT_START      /* 0xa0005 */
  900.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 | IPF_8WAY )
  901.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  902.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_8WAY )
  903.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_8WAY )
  904.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) /* also used in-game */
  905.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  906.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  907.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  908.  
  909.     PORT_START      /* 0xa0007 */
  910.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER3 | IPF_8WAY )
  911.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
  912.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER3 | IPF_8WAY )
  913.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER3 | IPF_8WAY )
  914.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START3 )
  915.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  916.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  917.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  918.  
  919.     KONAMI_TWIN_COINAGE
  920.  
  921.     PORT_START    /* DSW2 */
  922.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  923.     PORT_DIPSETTING(    0x03, "2" )
  924.     PORT_DIPSETTING(    0x02, "3" )
  925.     PORT_DIPSETTING(    0x01, "5" )
  926.     PORT_DIPSETTING(    0x00, "7" )
  927.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  928.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  929.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  930.  
  931.     PORT_DIPNAME( 0x08, 0x08, "Special" )//#players?
  932.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  933.  
  934.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  935.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  936.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  937.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  938.  
  939.     PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
  940.     PORT_DIPSETTING(    0x60, "Easy" )
  941.     PORT_DIPSETTING(    0x40, "Normal" )
  942.     PORT_DIPSETTING(    0x20, "Difficult" )
  943.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  944.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  945.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  946.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  947.  
  948.     PORT_START    /* DSW3 0xa0019 */
  949.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  950.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  951.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  952.     PORT_DIPNAME( 0x02, 0x00, "Controls" )
  953.     PORT_DIPSETTING(    0x02, "Single" )
  954.     PORT_DIPSETTING(    0x00, "Dual" )
  955.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  956.     PORT_DIPNAME( 0x08, 0x08, "Reserved" )
  957.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  958.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  959.  
  960.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  961.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  962.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  963.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  964.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  965.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  966.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  967.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  968.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  969.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  970.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  971.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  972.  
  973. //    PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  974. INPUT_PORTS_END
  975.  
  976. INPUT_PORTS_START( miaj )
  977.     PORT_START      /* 0xa0001 */
  978.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  979.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  980.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  981.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) /* advances through tests */
  982.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  983.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  984.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )
  985.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  986.  
  987.     PORT_START      /* 0xa0003 */
  988.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 | IPF_8WAY )
  989.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  990.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_8WAY )
  991.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_8WAY )
  992.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  993.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  994.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  995.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  996.  
  997.     PORT_START      /* 0xa0005 */
  998.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 | IPF_8WAY )
  999.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  1000.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_8WAY )
  1001.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_8WAY )
  1002.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  1003.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  1004.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  1005.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1006.  
  1007.     PORT_START      /* 0xa0007 */
  1008.     PORT_BIT( 0xff, 0xff, IPT_UNUSED )
  1009.  
  1010.     KONAMI_TWIN_COINAGE
  1011.  
  1012.     PORT_START    /* DSW2 */
  1013.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  1014.     PORT_DIPSETTING(    0x03, "2" )
  1015.     PORT_DIPSETTING(    0x02, "3" )
  1016.     PORT_DIPSETTING(    0x01, "5" )
  1017.     PORT_DIPSETTING(    0x00, "7" )
  1018.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  1019.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  1020.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1021.     PORT_DIPNAME( 0x18, 0x08, "Bonus" )
  1022.     PORT_DIPSETTING(    0x18, "30K 80K" )
  1023.     PORT_DIPSETTING(    0x08, "50K" )
  1024.     PORT_DIPSETTING(    0x10, "50K 100K" )
  1025.     PORT_DIPSETTING(    0x00, "100K" )
  1026.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  1027.     PORT_DIPSETTING(    0x60, "Easy" )
  1028.     PORT_DIPSETTING(    0x40, "Normal" )
  1029.     PORT_DIPSETTING(    0x20, "Difficult" )
  1030.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  1031.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  1032.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  1033.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1034.  
  1035.     PORT_START    /* DSW3 0xa0018 */
  1036.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  1037.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  1038.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1039.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  1040.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  1041.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1042.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  1043.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
  1044.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  1045.     PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
  1046.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  1047. INPUT_PORTS_END
  1048.  
  1049.  
  1050.  
  1051. static struct GfxLayout alpha_layout =
  1052. {
  1053.     8,8,
  1054.     0x200,
  1055.     4,
  1056.     { 0,1,2,3 },
  1057.     { 0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4 },
  1058.     { 0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32 },
  1059.     8*32
  1060. };
  1061.  
  1062. static struct GfxDecodeInfo gfxdecodeinfo[] =
  1063. {
  1064.     { REGION_GFX1, 0x00000, &alpha_layout, 0, 16 },
  1065.     { -1 }
  1066. };
  1067.  
  1068.  
  1069.  
  1070. static struct YM2151interface ym2151_interface =
  1071. {
  1072.     1,            /* 1 chip */
  1073.     7159160/2,    /* 3.58 MHZ ? */
  1074.     { YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) },
  1075.     { 0 }
  1076. };
  1077.  
  1078. static void volume_callback(int v)
  1079. {
  1080.     K007232_set_volume(0,0,(v >> 4) * 0x11,0);
  1081.     K007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
  1082. }
  1083.  
  1084. static struct K007232_interface k007232_interface =
  1085. {
  1086.     1,        /* number of chips */
  1087.     { REGION_SOUND1, REGION_SOUND1 }, /* memory regions */
  1088.     { K007232_VOL(20,MIXER_PAN_CENTER,20,MIXER_PAN_CENTER) },    /* volume */
  1089.     { volume_callback }    /* external port callback */
  1090. };
  1091.  
  1092. static struct UPD7759_interface upd7759_interface =
  1093. {
  1094.     1,        /* number of chips */
  1095.     UPD7759_STANDARD_CLOCK,
  1096.     { 20 }, /* volume */
  1097.     { REGION_SOUND2 }, /* memory region */
  1098.     UPD7759_STANDALONE_MODE, /* chip mode */
  1099.     {0}
  1100. };
  1101.  
  1102.  
  1103.  
  1104. #define MACHINE_DRIVER(NAME,NVRAM)                \
  1105. static struct MachineDriver machine_driver_##NAME =    \
  1106. {    \
  1107.     {    \
  1108.         {    \
  1109.             CPU_Z80 | CPU_AUDIO_CPU,    \
  1110.             3579545,    \
  1111.             readmem_sound,writemem_sound,0,0,    \
  1112.             ignore_interrupt,1    \
  1113.         },    \
  1114.         {    \
  1115.             CPU_M68000,    \
  1116.             10000000,    \
  1117.             readmem_sub,writemem_sub,0,0,    \
  1118.             CPUB_interrupt,1    \
  1119.         },    \
  1120.         {    \
  1121.             CPU_M68000,    \
  1122.             10000000,    \
  1123.             readmem,writemem,0,0,    \
  1124.             CPUA_interrupt,1    \
  1125.         },    \
  1126.     },    \
  1127.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    \
  1128.     100, /* CPU slices */    \
  1129.     0, /* init machine */    \
  1130.     \
  1131.     /* video hardware */    \
  1132.     320, 256, { 0, 319, 0+16, 255-16 },    \
  1133.     gfxdecodeinfo,    \
  1134.     0x400,0x400,    \
  1135.     0,    \
  1136.     \
  1137.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,    \
  1138.     0,    \
  1139.     twin16_vh_start,    \
  1140.     twin16_vh_stop,    \
  1141.     twin16_vh_screenrefresh,    \
  1142.     \
  1143.     /* sound hardware */    \
  1144.     SOUND_SUPPORTS_STEREO,0,0,0,    \
  1145.     {    \
  1146.         {    \
  1147.             SOUND_YM2151,    \
  1148.             &ym2151_interface    \
  1149.         },    \
  1150.         {    \
  1151.             SOUND_K007232,    \
  1152.             &k007232_interface,    \
  1153.         },    \
  1154.         {    \
  1155.             SOUND_UPD7759,    \
  1156.             &upd7759_interface    \
  1157.         }    \
  1158.     },    \
  1159.     NVRAM    \
  1160. };
  1161.  
  1162. MACHINE_DRIVER(twin16,0)
  1163. MACHINE_DRIVER(cuebrick,cuebrick_nvram_handler)
  1164.  
  1165. static struct MachineDriver machine_driver_heavysync =
  1166. {
  1167.     {
  1168.         {
  1169.             CPU_Z80 | CPU_AUDIO_CPU,
  1170.             3579545,
  1171.             readmem_sound,writemem_sound,0,0,
  1172.             ignore_interrupt,1
  1173.         },
  1174.         {
  1175.             CPU_M68000,
  1176.             10000000,
  1177.             readmem_sub,writemem_sub,0,0,
  1178.             CPUB_interrupt,1
  1179.         },
  1180.         {
  1181.             CPU_M68000,
  1182.             10000000,
  1183.             readmem,writemem,0,0,
  1184.             CPUA_interrupt,1
  1185.         },
  1186.     },
  1187.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
  1188.     1000, /* CPU slices */
  1189.     0, /* init machine */
  1190.  
  1191.     /* video hardware */
  1192.     320, 256, { 0, 319, 0+16, 255-16 },
  1193.     gfxdecodeinfo,
  1194.     0x400,0x400,
  1195.     0,
  1196.  
  1197.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,// | VIDEO_SUPPORTS_16BIT,
  1198.     0,
  1199.     twin16_vh_start,
  1200.     twin16_vh_stop,
  1201.     twin16_vh_screenrefresh,
  1202.  
  1203.     /* sound hardware */
  1204.     SOUND_SUPPORTS_STEREO,0,0,0,
  1205.     {
  1206.         {
  1207.             SOUND_YM2151,
  1208.             &ym2151_interface
  1209.         },
  1210.         {
  1211.             SOUND_K007232,
  1212.             &k007232_interface,
  1213.         },
  1214.         {
  1215.             SOUND_UPD7759,
  1216.             &upd7759_interface
  1217.         }
  1218.     }
  1219. };
  1220.  
  1221. static struct MachineDriver machine_driver_fround =
  1222. {
  1223.     {
  1224.         {
  1225.             CPU_Z80 | CPU_AUDIO_CPU,
  1226.             3579545,
  1227.             readmem_sound,writemem_sound,0,0,
  1228.             ignore_interrupt,1
  1229.         },
  1230.         {
  1231.             CPU_M68000,
  1232.             10000000,
  1233.             fround_readmem,fround_writemem,0,0,
  1234.             CPUA_interrupt,1
  1235.         },
  1236.     },
  1237.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
  1238.     100, /* CPU slices */
  1239.     0, /* init machine */
  1240.  
  1241.     /* video hardware */
  1242.     320, 256, { 0, 319, 0+16, 255-16 },
  1243.     gfxdecodeinfo,
  1244.     0x400,0x400,
  1245.     0,
  1246.  
  1247.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,// | VIDEO_SUPPORTS_16BIT,
  1248.     0,
  1249.     twin16_vh_start,
  1250.     twin16_vh_stop,
  1251.     twin16_vh_screenrefresh,
  1252.  
  1253.     /* sound hardware */
  1254.     SOUND_SUPPORTS_STEREO,0,0,0,
  1255.     {
  1256.         {
  1257.             SOUND_YM2151,
  1258.             &ym2151_interface
  1259.         },
  1260.         {
  1261.             SOUND_K007232,
  1262.             &k007232_interface,
  1263.         },
  1264.         {
  1265.             SOUND_UPD7759,
  1266.             &upd7759_interface
  1267.         }
  1268.     }
  1269. };
  1270.  
  1271. /******************************************************************************************/
  1272.  
  1273. ROM_START( devilw )
  1274.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1275.     ROM_LOAD( "dw-m03.rom",    0x00000,  0x8000, 0x7201983c )
  1276.  
  1277.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1278.     ROM_LOAD( "dw-m14.rom",    0x00000,  0x4000, 0xd7338557 ) /* characters */
  1279.  
  1280.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1281.     ROM_LOAD_EVEN( "dw-r07.rom",    0x00000, 0x10000, 0x53110c0b )
  1282.     ROM_LOAD_ODD(  "dw-r06.rom",    0x00000, 0x10000, 0x9c53a0c5 )
  1283.     ROM_LOAD_EVEN( "dw-r13.rom",    0x20000, 0x10000, 0x36ae6014 )
  1284.     ROM_LOAD_ODD(  "dw-r12.rom",    0x20000, 0x10000, 0x6d012167 )
  1285.  
  1286.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1287.     ROM_LOAD_EVEN( "dw-t05.rom",    0x00000, 0x10000, 0x8ab7dc61 )
  1288.     ROM_LOAD_ODD(  "dw-t04.rom",    0x00000, 0x10000, 0xc69924da )
  1289.     ROM_LOAD_EVEN( "dw-t09.rom",   0x20000, 0x10000, 0xfae97de0 )
  1290.     ROM_LOAD_ODD(  "dw-t08.rom",   0x20000, 0x10000, 0x8c898d67 )
  1291.  
  1292.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1293.     ROM_LOAD_WIDE_SWAP(    "dw-10p.rom",    0x000000, 0x80000, 0x66cb3923 )
  1294.     ROM_LOAD_WIDE_SWAP(    "dw-10r.rom",    0x080000, 0x80000, 0xa1c7d0db )
  1295.     ROM_LOAD_WIDE_SWAP(    "dw-10l.rom",    0x100000, 0x80000, 0xeec8c5b2 )
  1296.     ROM_LOAD_WIDE_SWAP(    "dw-10m.rom",    0x180000, 0x80000, 0x746cf48b )
  1297.  
  1298.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1299.     ROM_LOAD_EVEN( "dw-m11.rom",    0x00000, 0x10000, 0x399deee8 )
  1300.     ROM_LOAD_ODD(  "dw-m10.rom",    0x00000, 0x10000, 0x117c91ee )
  1301.  
  1302.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1303.     ROM_LOAD( "dw-ic5a.rom",    0x00000, 0x20000, 0xd4992dfb )
  1304.  
  1305.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1306.     ROM_LOAD( "dw-ic7c.rom",    0x00000, 0x20000, 0xe5947501 )
  1307. ROM_END
  1308.  
  1309. ROM_START( majuu )
  1310.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1311.     ROM_LOAD( "dw-m03.rom",    0x00000,  0x8000, 0x7201983c )
  1312.  
  1313.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1314.     ROM_LOAD_EVEN( "dw-r07.rom",    0x00000, 0x10000, 0x53110c0b )
  1315.     ROM_LOAD_ODD(  "dw-r06.rom",    0x00000, 0x10000, 0x9c53a0c5 )
  1316.     ROM_LOAD_EVEN( "dw-r13.rom",    0x20000, 0x10000, 0x36ae6014 )
  1317.     ROM_LOAD_ODD(  "dw-r12.rom",    0x20000, 0x10000, 0x6d012167 )
  1318.  
  1319.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1320.     ROM_LOAD_EVEN( "687-s05.6n",    0x00000, 0x10000, 0xbd99b434 )
  1321.     ROM_LOAD_ODD(  "687-s04.4n",    0x00000, 0x10000, 0x3df732e2 )
  1322.     ROM_LOAD_EVEN( "687-s09.6r",    0x20000, 0x10000, 0x1f6efec3 )
  1323.     ROM_LOAD_ODD(  "687-s08.4r",    0x20000, 0x10000, 0x8a16c8c6 )
  1324.  
  1325.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1326.     ROM_LOAD( "687-l14.d8",    0x00000,  0x4000, 0x20ecccd6 ) /* characters */
  1327.  
  1328.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1329.     ROM_LOAD_WIDE_SWAP(    "dw-10p.rom",    0x000000, 0x80000, 0x66cb3923 )
  1330.     ROM_LOAD_WIDE_SWAP(    "dw-10r.rom",    0x080000, 0x80000, 0xa1c7d0db )
  1331.     ROM_LOAD_WIDE_SWAP(    "dw-10l.rom",    0x100000, 0x80000, 0xeec8c5b2 )
  1332.     ROM_LOAD_WIDE_SWAP(    "dw-10m.rom",    0x180000, 0x80000, 0x746cf48b )
  1333.  
  1334.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1335.     ROM_LOAD_EVEN( "dw-m11.rom",    0x00000, 0x10000, 0x399deee8 )
  1336.     ROM_LOAD_ODD(  "dw-m10.rom",    0x00000, 0x10000, 0x117c91ee )
  1337.  
  1338.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1339.     ROM_LOAD( "dw-ic5a.rom",    0x00000, 0x20000, 0xd4992dfb )
  1340.  
  1341.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1342.     ROM_LOAD( "dw-ic7c.rom",    0x00000, 0x20000, 0xe5947501 )
  1343. ROM_END
  1344.  
  1345. ROM_START( darkadv )
  1346.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1347.     ROM_LOAD( "n03.10a",    0x00000,  0x8000, 0xa24c682f )
  1348.  
  1349.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1350.     ROM_LOAD_EVEN( "n07.10n",    0x00000, 0x10000, 0x6154322a )
  1351.     ROM_LOAD_ODD(  "n06.8n",    0x00000, 0x10000, 0x37a72e8b )
  1352.     ROM_LOAD_EVEN( "n13.10s",    0x20000, 0x10000, 0xf1c252af )
  1353.     ROM_LOAD_ODD(  "n12.8s",    0x20000, 0x10000, 0xda221944 )
  1354.  
  1355.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1356.     ROM_LOAD_EVEN( "n05.6n",    0x00000, 0x10000, 0xa9195b0b )
  1357.     ROM_LOAD_ODD(  "n04.4n",    0x00000, 0x10000, 0x65b55105 )
  1358.     ROM_LOAD_EVEN( "n09.6r",    0x20000, 0x10000, 0x1c6b594c )
  1359.     ROM_LOAD_ODD(  "n08.4r",    0x20000, 0x10000, 0xa9603196 )
  1360.  
  1361.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1362.     ROM_LOAD( "n14.3f",    0x0000,  0x4000, 0xc76ac6d2 ) /* characters */
  1363.  
  1364.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1365.     ROM_LOAD_WIDE_SWAP(    "dw-10p.rom",    0x000000, 0x80000, 0x66cb3923 )
  1366.     ROM_LOAD_WIDE_SWAP(    "dw-10r.rom",    0x080000, 0x80000, 0xa1c7d0db )
  1367.     ROM_LOAD_WIDE_SWAP(    "dw-10l.rom",    0x100000, 0x80000, 0xeec8c5b2 )
  1368.     ROM_LOAD_WIDE_SWAP(    "dw-10m.rom",    0x180000, 0x80000, 0x746cf48b )
  1369.  
  1370.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1371.     ROM_LOAD_EVEN( "dw-m11.rom",    0x00000, 0x10000, 0x399deee8 )
  1372.     ROM_LOAD_ODD(  "dw-m10.rom",    0x00000, 0x10000, 0x117c91ee ) /* tiles */
  1373.  
  1374.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1375.     ROM_LOAD( "dw-ic5a.rom",    0x00000, 0x20000, 0xd4992dfb )
  1376.  
  1377.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1378.     ROM_LOAD( "dw-ic7c.rom",    0x00000, 0x20000, 0xe5947501 )
  1379. ROM_END
  1380.  
  1381. /******************************************************************************************/
  1382.  
  1383. ROM_START( cuebrick )
  1384.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1385.     ROM_LOAD( "903-d03.10a",    0x00000,  0x8000, 0x455e855a )
  1386.  
  1387.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1388.     ROM_LOAD_EVEN( "903-d07.10n",    0x00000, 0x10000, 0xfc0edce7 )
  1389.     ROM_LOAD_ODD(  "903-d06.8n",    0x00000, 0x10000, 0xb2cef6fe )
  1390.     ROM_LOAD_EVEN( "903-e13.10s",    0x20000, 0x10000, 0x4fb5fb80 )
  1391.     ROM_LOAD_ODD(  "903-e12.8s",    0x20000, 0x10000, 0x883e3097 )
  1392.  
  1393.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1394.     ROM_LOAD_EVEN( "903-e05.6n",    0x00000, 0x10000, 0x8b556220 )
  1395.     ROM_LOAD_ODD(  "903-e04.4n",    0x00000, 0x10000, 0xbf9c7927 )
  1396.     ROM_LOAD_EVEN( "903-e09.6r",    0x20000, 0x10000, 0x2a77554d )
  1397.     ROM_LOAD_ODD(  "903-e08.4r",    0x20000, 0x10000, 0xc0a430c1 )
  1398.  
  1399.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1400.     ROM_LOAD( "903-e14.d8",    0x0000, 0x4000, 0xddbebbd5 ) /* characters */
  1401.  
  1402.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1403.     /* unpopulated */
  1404.  
  1405.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1406.     ROM_LOAD_EVEN( "903-e11.10r",    0x00000, 0x10000, 0x5c41faf8 )
  1407.     ROM_LOAD_ODD(  "903-e10.8r",    0x00000, 0x10000, 0x417576d4 )
  1408.  
  1409.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1410.     /* unpopulated */
  1411.  
  1412.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1413.     /* unpopulated */
  1414. ROM_END
  1415.  
  1416. ROM_START( vulcan )
  1417.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1418.     ROM_LOAD( "vulcan.g03",    0x00000,  0x8000, 0x67a3b50d )
  1419.  
  1420.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1421.     ROM_LOAD_EVEN( "vulcan.p07", 0x00000, 0x10000, 0x686d549d )
  1422.     ROM_LOAD_ODD(  "vulcan.p06", 0x00000, 0x10000, 0x70c94bee )
  1423.     ROM_LOAD_EVEN( "vulcan.p13", 0x20000, 0x10000, 0x478fdb0a )
  1424.     ROM_LOAD_ODD(  "vulcan.p12", 0x20000, 0x10000, 0x38ea402a )
  1425.  
  1426.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1427.     ROM_LOAD_EVEN( "vulcan.w05", 0x00000, 0x10000, 0x6e0e99cd )
  1428.     ROM_LOAD_ODD(  "vulcan.w04", 0x00000, 0x10000, 0x23ec74ca )
  1429.     ROM_LOAD_EVEN( "vulcan.w09", 0x20000, 0x10000, 0x377e4f28 )
  1430.     ROM_LOAD_ODD(  "vulcan.w08", 0x20000, 0x10000, 0x813d41ea )
  1431.  
  1432.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1433.     ROM_LOAD( "vulcan.h14",    0x0000, 0x4000, 0x02f4b16f ) /* characters */
  1434.  
  1435.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1436.     ROM_LOAD_WIDE( "vulcan.f17",    0x000000, 0x80000, 0x8fbec1a4 )
  1437.     ROM_LOAD_WIDE( "vulcan.f18",    0x080000, 0x80000, 0x50d61e38 )
  1438.     ROM_LOAD_WIDE( "vulcan.f15",    0x100000, 0x80000, 0xaf96aef3 )
  1439.     ROM_LOAD_WIDE( "vulcan.f16",    0x180000, 0x80000, 0xb858df1f )
  1440.  
  1441.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1442.  
  1443.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1444.     ROM_LOAD( "vulcan.f01",    0x00000, 0x20000, 0xa0d8d69e )
  1445.  
  1446.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1447.     ROM_LOAD( "vulcan.f02",    0x00000, 0x20000, 0xc39f5ca4 )
  1448. ROM_END
  1449.  
  1450. ROM_START( gradius2 )
  1451.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1452.     ROM_LOAD( "vulcan.g03",    0x00000,  0x8000, 0x67a3b50d )
  1453.  
  1454.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1455.     ROM_LOAD_EVEN( "vulcan.p07", 0x00000, 0x10000, 0x686d549d )
  1456.     ROM_LOAD_ODD(  "vulcan.p06", 0x00000, 0x10000, 0x70c94bee )
  1457.     ROM_LOAD_EVEN( "vulcan.p13", 0x20000, 0x10000, 0x478fdb0a )
  1458.     ROM_LOAD_ODD(  "vulcan.p12", 0x20000, 0x10000, 0x38ea402a )
  1459.  
  1460.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1461.     ROM_LOAD_EVEN( "785x05.bin", 0x00000, 0x10000, 0x8a23a7b8 )
  1462.     ROM_LOAD_ODD(  "785x04.bin", 0x00000, 0x10000, 0x88e466ce )
  1463.     ROM_LOAD_EVEN( "785x09.bin", 0x20000, 0x10000, 0x3f3d7d7a )
  1464.     ROM_LOAD_ODD(  "785x08.bin", 0x20000, 0x10000, 0xc39c8efd )
  1465.  
  1466.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1467.     ROM_LOAD( "gradius2.g14",    0x0000, 0x4000, 0x9dcdad9d ) /* characters */
  1468.  
  1469.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1470.     ROM_LOAD_WIDE( "vulcan.f17",    0x000000, 0x80000, 0x8fbec1a4 )
  1471.     ROM_LOAD_WIDE( "vulcan.f18",    0x080000, 0x80000, 0x50d61e38 )
  1472.     ROM_LOAD_WIDE( "vulcan.f15",    0x100000, 0x80000, 0xaf96aef3 )
  1473.     ROM_LOAD_WIDE( "vulcan.f16",    0x180000, 0x80000, 0xb858df1f )
  1474.  
  1475.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1476.  
  1477.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1478.     ROM_LOAD( "vulcan.f01",    0x00000, 0x20000, 0xa0d8d69e )
  1479.  
  1480.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1481.     ROM_LOAD( "vulcan.f02",    0x00000, 0x20000, 0xc39f5ca4 )
  1482. ROM_END
  1483.  
  1484. ROM_START( grdius2a )
  1485.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1486.     ROM_LOAD( "vulcan.g03",    0x00000,  0x8000, 0x67a3b50d )
  1487.  
  1488.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1489.     ROM_LOAD_EVEN( "vulcan.p07", 0x00000, 0x10000, 0x686d549d )
  1490.     ROM_LOAD_ODD(  "vulcan.p06", 0x00000, 0x10000, 0x70c94bee )
  1491.     ROM_LOAD_EVEN( "vulcan.p13", 0x20000, 0x10000, 0x478fdb0a )
  1492.     ROM_LOAD_ODD(  "vulcan.p12", 0x20000, 0x10000, 0x38ea402a )
  1493.  
  1494.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1495.     ROM_LOAD_EVEN( "gradius2.p05", 0x00000, 0x10000, 0x4db0e736 )
  1496.     ROM_LOAD_ODD(  "gradius2.p04", 0x00000, 0x10000, 0x765b99e6 )
  1497.     ROM_LOAD_EVEN( "785t09.bin",   0x20000, 0x10000, 0x4e3f4965 )
  1498.     ROM_LOAD_ODD(  "gradius2.j08", 0x20000, 0x10000, 0x2b1c9108 )
  1499.  
  1500.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1501.     ROM_LOAD( "gradius2.g14",    0x0000, 0x4000, 0x9dcdad9d ) /* characters */
  1502.  
  1503.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1504.     ROM_LOAD_WIDE( "vulcan.f17",    0x000000, 0x80000, 0x8fbec1a4 )
  1505.     ROM_LOAD_WIDE( "vulcan.f18",    0x080000, 0x80000, 0x50d61e38 )
  1506.     ROM_LOAD_WIDE( "vulcan.f15",    0x100000, 0x80000, 0xaf96aef3 )
  1507.     ROM_LOAD_WIDE( "vulcan.f16",    0x180000, 0x80000, 0xb858df1f )
  1508.  
  1509.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1510.  
  1511.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1512.     ROM_LOAD( "vulcan.f01",    0x00000, 0x20000, 0xa0d8d69e )
  1513.  
  1514.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1515.     ROM_LOAD( "vulcan.f02",    0x00000, 0x20000, 0xc39f5ca4 )
  1516. ROM_END
  1517.  
  1518. ROM_START( grdius2b )
  1519.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1520.     ROM_LOAD( "vulcan.g03",    0x00000,  0x8000, 0x67a3b50d )
  1521.  
  1522.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1523.     ROM_LOAD_EVEN( "vulcan.p07", 0x00000, 0x10000, 0x686d549d )
  1524.     ROM_LOAD_ODD(  "vulcan.p06", 0x00000, 0x10000, 0x70c94bee )
  1525.     ROM_LOAD_EVEN( "vulcan.p13", 0x20000, 0x10000, 0x478fdb0a )
  1526.     ROM_LOAD_ODD(  "vulcan.p12", 0x20000, 0x10000, 0x38ea402a )
  1527.  
  1528.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1529.     ROM_LOAD_EVEN( "gradius2.p05", 0x00000, 0x10000, 0x4db0e736 )
  1530.     ROM_LOAD_ODD(  "gradius2.p04", 0x00000, 0x10000, 0x765b99e6 )
  1531.     ROM_LOAD_EVEN( "gradius2.j09", 0x20000, 0x10000, 0x6d96a7e3 )
  1532.     ROM_LOAD_ODD(  "gradius2.j08", 0x20000, 0x10000, 0x2b1c9108 )
  1533.  
  1534.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1535.     ROM_LOAD( "gradius2.g14",    0x0000, 0x4000, 0x9dcdad9d ) /* characters */
  1536.  
  1537.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1538.     ROM_LOAD_WIDE( "vulcan.f17",    0x000000, 0x80000, 0x8fbec1a4 )
  1539.     ROM_LOAD_WIDE( "vulcan.f18",    0x080000, 0x80000, 0x50d61e38 )
  1540.     ROM_LOAD_WIDE( "vulcan.f15",    0x100000, 0x80000, 0xaf96aef3 )
  1541.     ROM_LOAD_WIDE( "vulcan.f16",    0x180000, 0x80000, 0xb858df1f )
  1542.  
  1543.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1544.  
  1545.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1546.     ROM_LOAD( "vulcan.f01",    0x00000, 0x20000, 0xa0d8d69e )
  1547.  
  1548.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1549.     ROM_LOAD( "vulcan.f02",    0x00000, 0x20000, 0xc39f5ca4 )
  1550. ROM_END
  1551.  
  1552. /******************************************************************************************/
  1553.  
  1554. ROM_START( hpuncher )
  1555.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1556.     ROM_LOAD( "870g03.10a",    0x00000,  0x8000, 0xdb9c10c8 )
  1557.  
  1558.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1559.     ROM_LOAD_EVEN( "870h07.10n",    0x00000, 0x10000, 0xb4dda612 )
  1560.     ROM_LOAD_ODD(  "870h06.8n",    0x00000, 0x10000, 0x696ba702 )
  1561.  
  1562.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1563.     ROM_LOAD_EVEN( "870h05.6n", 0x00000, 0x10000, 0x2bcfeef3 )
  1564.     ROM_LOAD_ODD(  "870h04.4n", 0x00000, 0x10000, 0xb9f97fd3 )
  1565.     ROM_LOAD_EVEN( "870h09.6r", 0x20000, 0x10000, 0x96a4f8b1 )
  1566.     ROM_LOAD_ODD(  "870h08.4r", 0x20000, 0x10000, 0x46d65156 )
  1567.  
  1568.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1569.     ROM_LOAD( "870f14.d8",    0x0000, 0x4000, 0xc9b46615 ) /* characters */
  1570.  
  1571.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1572.     ROM_LOAD_WIDE_SWAP(    "870c17.p16",    0x000000, 0x80000, 0x2bc99ff8 )
  1573.     ROM_LOAD_WIDE_SWAP(    "870c18.p18",    0x080000, 0x80000, 0x07927fe8 )
  1574.     ROM_LOAD_WIDE_SWAP(    "870c15.p13",    0x100000, 0x80000, 0x8c9281df )
  1575.     ROM_LOAD_WIDE_SWAP(    "870c16.p15",    0x180000, 0x80000, 0x41df6a1b )
  1576.  
  1577.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1578.     ROM_LOAD( "870c01.5a",    0x00000, 0x20000, 0x6af96546 )
  1579.  
  1580.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1581.     ROM_LOAD( "870c02.7c",    0x00000, 0x20000, 0x54e12c6d )
  1582. ROM_END
  1583.  
  1584. ROM_START( fround )
  1585.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1586.     ROM_LOAD( "frf03.bin",    0x00000,  0x8000, 0xa645c727 )
  1587.  
  1588.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU A) */
  1589.     ROM_LOAD_EVEN( "frl21.bin", 0x00000, 0x20000, 0xe21a3a19 )
  1590.     ROM_LOAD_ODD(  "frl20.bin", 0x00000, 0x20000, 0x0ce9786f )
  1591.  
  1592.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1593.     ROM_LOAD( "870f14.d8",    0x0000, 0x4000, 0xc9b46615 ) /* characters */
  1594.  
  1595.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1596.     ROM_LOAD_WIDE_SWAP(    "870c17.p16",    0x080000, 0x80000, 0x2bc99ff8 )
  1597.     ROM_LOAD_WIDE_SWAP(    "870c18.p18",    0x000000, 0x80000, 0x07927fe8 )
  1598.     ROM_LOAD_WIDE_SWAP(    "870c15.p13",    0x180000, 0x80000, 0x8c9281df )
  1599.     ROM_LOAD_WIDE_SWAP(    "870c16.p15",    0x100000, 0x80000, 0x41df6a1b )
  1600.  
  1601.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1602.     ROM_LOAD( "870c01.5a",    0x00000, 0x20000, 0x6af96546 )
  1603.  
  1604.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1605.     ROM_LOAD( "870c02.7c",    0x00000, 0x20000, 0x54e12c6d )
  1606. ROM_END
  1607.  
  1608. /******************************************************************************************/
  1609.  
  1610. ROM_START( miaj )
  1611.     ROM_REGION( 0x10000, REGION_CPU1 ) /* Z80 code (sound CPU) */
  1612.     ROM_LOAD( "808e03.f4",    0x00000,  0x8000, 0x3d93a7cd )
  1613.  
  1614.     ROM_REGION( 0x40000, REGION_CPU2 ) /* 68000 code (CPU B) */
  1615.     ROM_LOAD_EVEN(    "808e07.bin",    0x00000, 0x10000, 0x297bdcea )
  1616.     ROM_LOAD_ODD(    "808e06.bin",    0x00000, 0x10000, 0x8f576b33 )
  1617.     ROM_LOAD_EVEN(    "808e13.h28",    0x20000, 0x10000, 0x1fa708f4 )
  1618.     ROM_LOAD_ODD(    "808e12.f28",    0x20000, 0x10000, 0xd62f1fde )
  1619.  
  1620.     ROM_REGION( 0x40000, REGION_CPU3 ) /* 68000 code (CPU A) */
  1621.     ROM_LOAD_EVEN(    "808r05.bin", 0x00000, 0x10000, 0x91fd83f4 )
  1622.     ROM_LOAD_ODD(    "808r04.bin", 0x00000, 0x10000, 0xf1c8c597 )
  1623.     ROM_LOAD_EVEN(    "808r09.bin", 0x20000, 0x10000, 0xf74d4467 )
  1624.     ROM_LOAD_ODD(    "808r08.bin", 0x20000, 0x10000, 0x26f21704 )
  1625.  
  1626.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1627.     ROM_LOAD(    "808e14.bin",    0x0000, 0x4000, 0xb9d36525 ) /* characters */
  1628.  
  1629.     ROM_REGION( 0x200000, REGION_GFX2 )    /* gfx data used at runtime */
  1630.     ROM_LOAD_WIDE_SWAP(    "808d17.j4",    0x000000, 0x80000, 0xd1299082 )
  1631.     ROM_LOAD_WIDE_SWAP(    "808d15.h4",    0x100000, 0x80000, 0x2b22a6b6 )
  1632.  
  1633.     ROM_REGION( 0x20000, REGION_GFX3 ) /* tile data; mapped at 0x80000 on CPUB */
  1634.  
  1635.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples */
  1636.     ROM_LOAD(    "808d01.d4",    0x00000, 0x20000, 0xfd4d37c0 )
  1637.  
  1638.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples */
  1639. ROM_END
  1640.  
  1641. /******************************************************************************************/
  1642.  
  1643. static void gfx_untangle( void )
  1644. { /* sprite, tile data */
  1645.     int i;
  1646.     UINT16 *temp = (UINT16 *)malloc(0x200000);
  1647.     if( temp )
  1648.     {
  1649.         twin16_gfx_rom = (UINT16 *)memory_region(REGION_GFX2);
  1650.         memcpy( temp, twin16_gfx_rom, 0x200000 );
  1651.  
  1652.         for( i=0; i<0x080000; i++ )
  1653.         {
  1654.             twin16_gfx_rom[i*2+0] = temp[i+0x080000];
  1655.             twin16_gfx_rom[i*2+1] = temp[i];
  1656.         }
  1657.         free( temp );
  1658.     }
  1659. }
  1660.  
  1661. static void init_twin16(void)
  1662. {
  1663.     gfx_untangle();
  1664.     twin16_custom_vidhrdw = 0;
  1665. }
  1666.  
  1667. static void init_fround(void)
  1668. {
  1669.     gfx_untangle();
  1670.     twin16_custom_vidhrdw = 1;
  1671. }
  1672.  
  1673.  
  1674. GAME( 1987, devilw,   0,      heavysync, devilw,   twin16, ROT0, "Konami", "Devil World" )
  1675. GAME( 1987, majuu,    devilw, heavysync, devilw,   twin16, ROT0, "Konami", "Majuu no Ohkoku" )
  1676. GAME( 1987, darkadv,  devilw, heavysync, darkadv,  twin16, ROT0, "Konami", "Dark Adventure" )
  1677. GAME( 1988, vulcan,   0,      twin16,    vulcan,   twin16, ROT0, "Konami", "Vulcan Venture" )
  1678. GAME( 1988, gradius2, vulcan, twin16,    gradius2, twin16, ROT0, "Konami", "Gradius II - Gofer no Yabou (Japan set 1)" )
  1679. GAME( 1988, grdius2a, vulcan, twin16,    gradius2, twin16, ROT0, "Konami", "Gradius II - Gofer no Yabou (Japan set 2)" )
  1680. GAME( 1988, grdius2b, vulcan, twin16,    gradius2, twin16, ROT0, "Konami", "Gradius II - Gofer no Yabou (Japan set 3)" )
  1681. GAME( 1989, cuebrick, 0,      cuebrick,  twin16,   twin16, ROT0, "Konami", "Cuebrick" )
  1682. GAME( 1988, fround,   0,      fround,    fround,   fround, ROT0, "Konami", "Final Round" )
  1683. GAME( 1988, hpuncher, fround, twin16,    fround,   twin16, ROT0, "Konami", "Hard Puncher (Japan)" )
  1684. GAME( 1989, miaj,     mia,    twin16,    miaj,     twin16, ROT0, "Konami", "Missing in Action (Japan)" )
  1685.